using UnityEngine;
using System.Collections;

public class MuzzleFlash2 : MonoBehaviour 
{
	public Renderer muzzleFlash;
	public Light muzzleLight;
	
	void Awake()
	{
		
	}	
	// Use this for initialization
	void Start ()
	{
		muzzleFlash.enabled = false;
		muzzleLight.enabled = false;
		
	
	}
	
	// Update is called once per frame
	void Update () 
	{
		if(Input.GetKeyDown(KeyCode.Q))
		{
			StartCoroutine("Shoot");
		}
	
	}
	IEnumerator Shoot()
	{
		muzzleFlash.renderer.enabled = true;
		muzzleLight.enabled = true;
		yield return new WaitForSeconds(0.02f);
		muzzleFlash.renderer.enabled = false;
		muzzleLight.enabled = false;
	}
}
